package example.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class MyMVCconfig implements WebMvcConfigurer {

    @Resource
    Mylnterceptor myInterceptor;


     @Override
    public void addInterceptors(InterceptorRegistry registry){
         registry.addInterceptor(myInterceptor)
                 .addPathPatterns("/**");

     }

   @Override
    public void addViewControllers(ViewControllerRegistry registry) {
         registry.addViewController("/login.html").setViewName("login");
         registry.addViewController("/").setViewName("login");

   }
    }

